<template>
  <div>
    <el-popover placement="bottom-end" v-model="visiblePatient" trigger="focus">
      <el-input
        :placeholder="dialogParams.placeholder"
        slot="reference"
        v-model="dialogParams.userinfo.name"
        @input="getpatientList()"
      >
      </el-input>

      <el-table
        v-loading="patientLoading"
        @current-change="xuanzePatient"
        highlight-current-row
        height="300"
        :data="
          peopleData.filter(
            (data) =>
              !dialogParams.userinfo.name ||
              data.real_name.toLowerCase().includes(dialogParams.userinfo.name.toLowerCase())
          )
        "
        
      >
        <el-table-column type="index" label="序号" width="50">
        </el-table-column>

        <el-table-column
          width="100"
          property="number"
          label="编码"
        ></el-table-column>
        <el-table-column
          width="200"
          property="real_name"
          label="name"
        ></el-table-column>

        <el-table-column
          width="150"
          property="dept_name"
          label="科室"
        ></el-table-column>
      </el-table>
      <el-pagination
        :current-page="params.page"
        :page-size="params.limit"
        @current-change="pageUser"
        :total="params.peopleCount"
        layout="prev, pager, next"
      >
      </el-pagination>
    </el-popover>
  </div>
</template>    
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
<script>
let t;
import { mapState, mapMutations, mapActions } from "vuex";
export default {
  data() {
    return {
      visiblePatient: false,
      patientLoading: false,
      params: {
      
        page: 1,
        limit: 10,
        peopleCount: 0,
      },
      peopleData: [],

   
    };
  },
  mounted() {
    t = this;
    this.getpatientList();

   
  },
  methods: {
  

    pageUser(e) {
      this.params.page = e;
      this.getpatientList();
    },
    xuanzePatient(item) {
      console.log("item",item)
      if (item) {
       this.dialogParams.userinfo.name = item.real_name;
       this.dialogParams.userinfo.id=item.id;

      
        this.visiblePatient = false;
      }
    },
    getpatientList() {
      this.patientLoading = true;
      this.peopleData = [];
      let d = {
        real_name:this.dialogParams.userinfo.name,
        page: this.params.page,
        limit: this.params.limit,
        user_type:this.dialogParams.d.user_type,
      };
      this["_API"].getUserIndex(d).then((res) => {
        this.patientLoading = false;
        if (res.code == 200) {
          this.peopleData = res.data.list;
          this.params.peopleCount = res.data.count;
        }
      });
    },
  },
  props: [ "thatF","dialogParams"],

};
</script>

<style lang="scss" scoped>
</style>